package com.ushine.design.design.c_behavioral_pattern.e_mediator.b_example;

public class ConcreteMediator extends Mediator {
    //维持对各个对象的引用
    public Button addButton;
    public List list;
    public ComboxBox bo;
    public TextBox userNameTextBox;

    @Override
    public void componentChanged(Component c) {
        if (c == addButton) {
            System.out.println(" -- 单击增加按钮 -- ");
            list.update();
            bo.update();
            userNameTextBox.update();
        } else if (c == list) {
            System.out.println(" -- 从列表框选择客户 -- ");
            bo.select();
            ;
            userNameTextBox.setText();
        } else if (c == bo) {
            System.out.println(" -- 从组合框选择客户 -- ");
            bo.select();
            userNameTextBox.setText();
        }
    }

}
